package com.cloudfun.campusshare.entity;

import com.cloudfun.campusshare.common.constant.BankType;
import com.cloudfun.campusshare.common.constant.KjtAuditStatus;
import com.cloudfun.campusshare.common.constant.SettleType;
import com.cloudfun.campusshare.common.constant.ShopType;
import com.kjtpay.gateway.common.enums.SubMerchantType;
import lombok.Data;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.validator.constraints.Length;

import javax.persistence.*;
import java.time.LocalDate;

/**
 * Created by Huqin on 2020/8/10
 */
@Data
@Entity
@Table(name = "kjt_sub_merchant")
@org.hibernate.annotations.Table(appliesTo = "kjt_sub_merchant", comment = "子商户信息")
public class SubMerchantEntity extends BaseEntity {

    @Id
    @GenericGenerator(name = "id_uuid", strategy = "uuid")
    @GeneratedValue(generator = "id_uuid")
    @Column(unique = true, columnDefinition = ("varchar(40) not null comment '主键uuid'"))
    private String id;

    @Column(unique = true, columnDefinition = ("varchar(40) not null comment '客户Id'"))
    private String userId;

    @Column(columnDefinition = ("varchar(32) not null comment '子商户类型'"))
    @Enumerated(EnumType.STRING)
    private SubMerchantType customerType;

    @Column(columnDefinition = ("varchar(32) not null comment '法人姓名'"))
    private String name;

    @Column(columnDefinition = ("varchar(64) not null comment '法人身份证'"))
    private String certificatesNumber;

    @Column(columnDefinition = ("date not null comment '身份证有效期'"))
    private LocalDate certificatesValidity;

    @Column(columnDefinition = ("varchar(32) not null comment '企业所属省份'"))
    private String province;

    @Column(columnDefinition = ("varchar(32) not null comment '企业所属地市'"))
    private String city;

    @Column(columnDefinition = ("varchar(64) not null comment '企业所属区县'"))
    private String area;

    @Column(columnDefinition = ("varchar(256) not null comment '企业详细地址'"))
    @Length(min = 6, max = 256, message = "详细地址限制6-256个字符")
    private String address;

    @Column(columnDefinition = ("varchar(16) not null comment '联系人姓名'"))
    private String contactName;

    @Column(columnDefinition = ("varchar(16) not null comment '联系人手机号'"))
    private String phoneNum;

    @Column(unique = true, columnDefinition = ("varchar(64) not null comment '联系人邮箱'"))
    private String email;

    @Column(columnDefinition = ("varchar(32) not null comment '银行卡类别'"))
    @Enumerated(EnumType.STRING)
    private BankType companyOrPerson;

    @Column(columnDefinition = ("varchar(32) not null comment '结算银行卡号'"))
    private String bankCardNo;

    @Column(columnDefinition = ("varchar(32) not null comment '银行卡户名'"))
    private String bankAccountName;

    @Column(columnDefinition = ("varchar(16) not null comment '开户银行编码'"))
    private String bankCode;

    @Column(columnDefinition = ("varchar(16) not null comment '开户行名称'"))
    private String bankName;

    @Column(columnDefinition = ("varchar(16) not null comment '开户行省份'"))
    private String bankProv;

    @Column(columnDefinition = ("varchar(16) not null comment '开户行城市编码'"))
    private String bankCity;

    @Column(columnDefinition = ("varchar(128) not null comment '开户银行支行名称'"))
    private String bankBranchName;

    @Column(columnDefinition = ("varchar(32) not null comment '商户店面类型'"))
    @Enumerated(EnumType.STRING)
    private ShopType shopType;

    @Column(columnDefinition = ("varchar(32) not null comment '结算方式'"))
    @Enumerated(EnumType.STRING)
    private SettleType settleType;

    @Column(columnDefinition = ("int(10) default null comment '委托提现起结金额'"))
    private Integer entrustWithdrawalAmount;

    @Column(columnDefinition = ("varchar(32) not null comment '营业执照号'"))
    private String businessLicenseNo;

    @Column(columnDefinition = ("date not null comment '营业执照有效期'"))
    private LocalDate businessLicenseValidity;

    @Column(columnDefinition = ("tinyint(1) not null comment '是否三证合一'"))
    private Boolean threeCertFlag;

    @Column(columnDefinition = ("varchar(32) default null comment '组织机构代码证号'"))
    private String organizationCode;

    @Column(columnDefinition = ("varchar(32) default null comment '税务登记证号'"))
    private String taxRegistryNo;

    @Column(unique = true, columnDefinition = ("varchar(32) default null comment '快捷通分配的用户id'"))
    private String identityId;

    @Column(columnDefinition = ("varchar(32) not null comment '开户状态'"))
    @Enumerated(EnumType.STRING)
    private KjtAuditStatus openingStatus;

    @Column(columnDefinition = ("varchar(256) default null comment '开户失败原因'"))
    private String failReason;

    @Column(columnDefinition = ("varchar(32) not null comment '影印件审核状态'"))
    @Enumerated(EnumType.STRING)
    private KjtAuditStatus auditStatus;

    @Column(columnDefinition = ("varchar(256) default null comment '准入审核驳回原因'"))
    private String rejectReason;

}
